// pages/my1/index.js
const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    gender:"",
    username:"",
    userid:'121212123',
    imgUrl:"",
    desc:" ",
    menuitems: [
      { text: '我的关注', url: '#', icon: '/images/我的关注.png', tips: '', arrows: '/images/arrows.png' },
      { text: '离线中心', url: '#', icon: '/images/离线中心.png', tips: '', arrows: '/images/arrows.png' },
      { text: '优惠用卷', url: '#', icon: '/images/优惠卷.png', tips: '', arrows: '/images/arrows.png' },
      { text: '意见反馈', url: '#', icon: '/images/意见反馈.png', tips: '', arrows: '/images/arrows.png' },
      { text: '客服联系', url: '#', icon: '/images/在线客服.png', tips: '', arrows: '/images/arrows.png' },
      { text: '关于我们', url: '#', icon: '/images/关于我们.png', tips: '', arrows: '/images/arrows.png' },
      { text: '检查更新', url: '#', icon: '/images/检查更新.png', tips: '', arrows: '/images/arrows.png' }
    ],
    orderItems: [
      {
        typeId: 0,
        name: '购物车',
        url: 'bill',
        imageurl: '/images/购物车.png',
      },
      {
        typeId: 1,
        name: '我的订单',
        url: 'bill',
        imageurl: '/images/我的订单.png',
      },
      {
        typeId: 2,
        name: '我的收藏',
        url: 'bill',
        imageurl: '/images/我的收藏.png'
      }
    ],
},
onShow(){
  var openid=wx.getStorageSync('openid')
  //console.log(openid);
  wx.request({
  url: 'http://127.0.0.1:9000/user1/person',
  method:'POST',
  data:{
    openid:openid
  },
  header: {
    'content-type': 'application/x-www-form-urlencoded' 
    // 默认值
  },
  success:(res)=>{
    //console.log(res);
    wx.setStorageSync('userinfo', res.data)
    this.setData({
      imgUrl:res.data.imgUrl,
      userid:res.data.openid,
      username:res.data.nickName,
      desc:res.data.desc
    })
  }
})
},
xinxi:function(){
  wx.navigateTo({
    url: '/pages/person/my/index',
  })
},

gouwuche:function(){
   wx.navigateTo({
     url: '/pages/person/gouwu/index',
   })
},
dingdan:function(){
  wx.navigateTo({
    url: '/pages/person/dingdan/index',
  })
},
shoucang:function(){
  wx.navigateTo({
    url: '/pages/person/shoucang/index',
  })
},
address:function(){
  wx.navigateTo({
    url: '/pages/person/dizhi/index',
  })
},
juan:function(){
  wx.navigateTo({
    url: '/pages/person/youhui/index',
  })
},
tuichu:function(){
  wx.setStorageSync('openid', "")
  wx.reLaunch({
    url: '/pages/person/login/index',
  })
},


contact: function (e) {
  // 调用拨打电话API
  wx.makePhoneCall({
    phoneNumber: '400-321'   // 该电话号码为模拟数据
  })
},
we:function(){
  wx.navigateTo({
    url: '/pages/person/we/index',
  })
},

})
